#include "output_builder.hpp"

namespace my_log
{
    output_t output_builder<screen_output>::build()
    {
        return screen_output{};
    }

    void output_builder<screen_output>::changeName(const std::filesystem::path&)
    {}

    output_builder<file_output>::output_builder(const std::filesystem::path& name, size_t buf_size)
        : _name(name)
        , _buf_size(buf_size)
    {}

    output_t output_builder<file_output>::build()
    {
        return file_output{ _name, _buf_size };
    }

    void output_builder<file_output>::changeName(const std::filesystem::path& name)
    {
        _name = name;
    }
	
    output_builder<roll_file_output>::output_builder(const std::filesystem::path& name_base, size_t single_file_size, size_t buf_size)
        : _name_base(name_base)
        , _single_file_size(single_file_size)
        , _buf_size(buf_size)
    {}

    output_t output_builder<roll_file_output>::build()
    {
        return roll_file_output{ _name_base, _single_file_size, _buf_size };
    }

    void output_builder<roll_file_output>::changeName(const std::filesystem::path& name)
    {
        _name_base = name;
    }

    std::vector<output_t> output_arr_builder::build()
    {
        std::vector<output_t> output;
        for (const auto& ptr : _builder_arr)
        {
            output.emplace_back(ptr->build());
        }
        return output;
    }

    void output_arr_builder::changeName(size_t index, const std::filesystem::path& name)
    {
        _builder_arr[index]->changeName(name);
    }
}